<template>
  <div>
    <button>{{ val }}</button>
    <button @click="incr">+</button>
    <div>{{ people }}</div>
    名字：<input v-model="currentName" /> 年龄：<input v-model="currentAge" />
    <button @click="add">添加</button>
  </div>
</template>
<script lang="js">
/**
 * 页面核心数据结构体说明文档
 *
 *
 */
// import from

export default {
  name: "Practise1",
  props: {
    sampleP: {
      type: Number,
      default: 0,
    },
  },
  // let val =1 ;
  data() {
    return {
      sampleD: "value",
      val:2,
      people:[{name:'zhangsan',age:11},{name:'lisi',age:12}],
      currentName:'xx',
      currentAge:1
    };
  },
  computed: {
    /* sampleC() {
      return this.sampleD + "--";
    }, */
  },
  created() {},
  mounted() {},
  methods: {
    // sampleM() {},
    incr(){
     this.val = this.val + 1;
    },
    add(){
      console.log(this.currentName,this.currentAge)
      this.people.push(
        {
        name:this.currentName,
        age:this.currentAge
        }
      )
    }
  },
  watch: {
    // sampleP(n, o) {},
  },
};
</script>

<!--<style scoped>-->
<style lang="scss" scoped></style>
